package corej.course.collection.set.sortedset;

import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;

public class TestSortedSet {
    @SuppressWarnings("unchecked")
    public static void main(String[] args) {
        Set s = new TreeSet();

        /*
           * s.add("Liucy"); s.add("Hiloo"); s.add("Liuxf"); s.add("George");
           * s.add("Liucy");
           */
        Student s1 = new Student("Liucy", 30);
        Student s2 = new Student("Hiloo", 30);
        Student s3 = new Student("Huxz", 18);
        Student s4 = new Student("Liucy", 30);

        s.add(s1);
        s.add(s2);
        s.add(s3);
        s.add(s4);

        print(s);
    }

    public static void print(Collection c) {
        Iterator it = c.iterator();
        while (it.hasNext()) {
            System.out.println(it.next());
        }
    }
}
